Skip to content

fix(concerto-linter): traverse inheritance hierarchy in abstract-must-subclassed rule (closes #1651) - #1652

Open
Ashu-213 wants to merge 1 commit into
accordproject:mainfrom
Ashu-213:fix-linter-abstract-subclassed
Open

Ashu-213 wants to merge 1 commit into
accordproject:mainfrom
Ashu-213:fix-linter-abstract-subclassed

Conversation

@Ashu-213

Copy link
Copy Markdown

Closes #1651

The abstract-must-subclassed linter rule previously only inspected the immediate superType.name on direct concrete declarations. In multi-level inheritance hierarchies (e.g. Vehicle (abstract) <- MotorVehicle (abstract) <- Car (concrete)), root abstract declarations were falsely reported as lacking concrete subclasses.

This PR traverses the superType hierarchy transitively for all concrete declarations so all ancestor declarations in the chain are recognized as having concrete subclasses.

Changes

  • Updated hasConcreteSubclass in packages/concerto-linter/default-ruleset/src/functions/find-abstract-declaration.ts to build a declaration lookup map and traverse the superType chain up to the root for each concrete declaration.
  • Added a visited set to guard against circular inheritance cycles.
  • Added test fixtures abstract-must-subclassed-multilevel-valid.cto and abstract-must-subclassed-multilevel-invalid.cto.
  • Added unit tests in packages/concerto-linter/default-ruleset/test/rules/abstract-must-subclassed.test.ts covering multi-level inheritance and branching hierarchies.

Flags

  • None.

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

…-subclassed rule (closes accordproject#1651)

Signed-off-by: ashup <ashuptdr4@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 19, 2026 16:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@mira-accord-project

Copy link
Copy Markdown

Thank you for this pull request, Ashu-213. It fixes the false positive reported in #1651 by following the full superType chain when deciding whether an abstract concept has a concrete subclass, so indirect subclasses through multi-level inheritance are now recognised. It also adds a valid and a branching invalid fixture with matching tests, which makes the intended behaviour easy to check. Jonathan Casey and Jamie Shorten have been asked to review. The CI runs for this pull request need approval before they start, and once they finish a maintainer will review the change and reply here. Thanks again for the contribution.


Posted automatically by Mira, an Accord Project agent. A maintainer will follow up; they make the decisions on this.

@mira-accord-project mira-accord-project Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this fix, and for the clear linked issue. Walking each concrete declaration's superType chain fixes the false positives on root abstract types in multi-level hierarchies. The visited-set guard protects against cycles, and supertypes that aren't in the model (imports) end the walk cleanly. The two new tests are well chosen: the valid multi-level case would have failed before the change, and the branching case pins that only WaterVehicle is reported. I found nothing that needs changing, so this is ready for a maintainer to approve.

No problems found.


Automated review by Mira, an Accord Project agent, at 73ce8c6. Findings are labelled blocking, should-fix or nit; a maintainer makes the final call.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(concerto-linter): abstract-must-subclassed rule falsely flags abstract declarations with indirect concrete subclasses

2 participants